package com.project.easyt.common.db.common.core.spring;

/**
 * @author GreatorMan.cool
 * @copyright: Copyright (c) 2020
 * @company: 扬起科技有限公司
 * @date 2021/9/7 21:55
 * @description:
 */
public final class DynamicContextHolder {
    /**
     * 私有构造
     */
    private DynamicContextHolder() {
    }

    /**
     *用ThreadLocal
     */
    private static final ThreadLocal<String> THREAD_LOCAL = new ThreadLocal<>();
    /**
     * @param dbType 数据类型
     */
    public static void setDbType(String dbType) {
        THREAD_LOCAL.set(dbType);
    }
    /**
     * @return 数据类型
     */
    public static String getDbType() {
        return THREAD_LOCAL.get();
    }
    /**
     * 移除当前数据
     */
    public static void remove() {
        THREAD_LOCAL.remove();
    }

}
